package com.photoeditor.demo.model.subscribe.strategy;

import android.support.annotation.NonNull;

import com.common.commercialize.strategy.bean.RateStrategyBean;
import com.common.commercialize.strategy.bean.StrategyBean;
import com.photoeditor.demo.model.subscribe.manager.SkuManager;

import org.json.JSONObject;

    public class SkuStrategyBean extends StrategyBean<SkuStrategyBean.SkuStrategyBeanConfig> {

        @Override
        protected SkuStrategyBeanConfig makeConfig(@NonNull JSONObject jsonObject) {
            return SkuStrategyBeanConfig.make(jsonObject);
        }

        public static class SkuStrategyBeanConfig extends StrategyBean.Config {
            //下发的年费，月费类型
            public static final String ANNUAL = "annual";
            private String mAnnualType;

            public static final String MONTH = "month";
            private String mMonthType;

            public String getAnnualType() {
                return mAnnualType;
            }

            public void setAnnualType(String mAnnualType) {
                this.mAnnualType = mAnnualType;
            }

            public void setMonthType(String mMonthType) {
                this.mMonthType = mMonthType;
            }

            public String getMonthType() {
                return mMonthType;
            }

            @Override
            protected void analysis(@NonNull JSONObject jsonObject) {
                super.analysis(jsonObject);
                mAnnualType = jsonObject.optString(ANNUAL, SkuManager.SKU_YEARLY_NORMAL);
                mMonthType = jsonObject.optString(MONTH, SkuManager.SKU_MONTHLY_NORMAL);
            }

            public static SkuStrategyBeanConfig make(@NonNull JSONObject jsonObject) {
                SkuStrategyBeanConfig config = new SkuStrategyBeanConfig();
                config.analysis(jsonObject);
                return config;
            }
        }


}
